package com.AAA.service.Impl.sas;

import com.AAA.entity.MyPage;
import com.AAA.entity.sas.TSasPlane;
import com.AAA.service.sas.TSasPlaneService;
import com.AAA.dao.sas.ITSasPlaneMapper;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TSasPlane)表服务实现类
 *
 * @author 何泽明
 * @since 2022-10-28 17:23:16
 */
@Service
public class TSasPlaneServiceImpl implements TSasPlaneService {
   @Autowired
   private ITSasPlaneMapper mapper;

   //分页查询
   @Override
   public PageInfo query(MyPage myPage, TSasPlane tSasPlane) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      List<TSasPlane> tSasPlanes = mapper.queryAll(tSasPlane);
      PageInfo pageInfo = new PageInfo(tSasPlanes);
      return pageInfo;
   }

   //单添加
   @Override
   public boolean add(TSasPlane tSasPlane) {
      int insert = mapper.insert(tSasPlane);
      if (insert>0) {
         return true;
      }
      return false ;
   }

   //编辑——修改题目信息
   @Override
   public boolean edit(TSasPlane tSasPlane) {
      int i = mapper.updateByPrimaryKeySelective(tSasPlane);
      if (i > 0){
         return true;
      }
      return false;
   }

   //状态：开/关（启用/禁用）
   @Override
   public boolean updates(TSasPlane tSasPlane) {
      int i = mapper.updateByPrimaryKeySelective(tSasPlane);
      if (i > 0){
         return true;
      }
      return false;
   }

   @Override
   public TSasPlane queryByQyCode(TSasPlane tSasPlane) {
      TSasPlane tSasPlane1 = mapper.selectOne(tSasPlane);
      return tSasPlane1;
   }
}

